fixed loadTasks function