polishing/fixing some gps code