Fix task closures

Updates the task closures to work as expected