fixing possible location crash.