Fixed a bug with teleport due to previous refactoring