Fixed the auto gps function.

@Smuldr @ktsitsikas Could you QA?