syntax error on the when condition