Getting location query to work correctly