fixed scope of location bug