Fix bugs in geo lib