Fix to addTask functionality