fixing wrong conditions