issue #1089: improve the if condition, avoid the error in IOS