revert and fix condition