improved performance of checkLocation