fixed out of range exception in changelocation