fixed conditions bug