gps switch now writes state to db