fix pseudo code