Replace 'for' loops to 'while' because wrong syntax.