fixed error with ternary operator