Fixing bug whereby location is not saved on first click