Fix crash caused by teleportation spells (Fixes #1904)