fix travis error, using if else instead of ternary operator