fix if condition to be compliant with ES5