fixed a condition bug