Fixes #85 - stupid typo in switch statement and better data check