fix a condition bug