Fixed While

Fixed while to work correctly.