debugged SJF algorithm