Fixed a bug in resetting and teleporting