Fix task creation bug