fix various crashes in entites