Fixed a bug in getting the location