Fixed case/when mistake

Figured out the mistake with the syntax of case/when.