fixed typo in algorithm