Fixed code generation for multiple tasks in a callback method