check class type early
Merge pull request #36 from jdreesen/improve-type-checks

Check class type early