fixed error not dispatching

Switching the if/else block to a switch block fixes Issue #2. I'm not sure why.