wrap ternary operator in another if