Fixed Wrong While Loop