Fixing error in pseudo code