Fixing wrong condition