Fixed issue of sorted tasks being increased by 1