syntax error fixed -> case ... when