Added test and fix for task management