Fixing funcition createTask