Fix broken context in Entity.addTask()