fixed wrong conditions.