fixed algorithm semicolon bug