Fixed getDisplayedTasks method