Fix crash bug with treasure chests.