BRST treatment of zero modes for the worldline formalism in curved space