fixed bug in algorithm time limit