Fixing switch statement compiler error