Fix to compiler problem for decoding

Change switch/case statement to if/else