Fixing bug when going to a wrong location