Fixed missing asignment in While loop