added boolean check in onlocationchange