fix undefined classes.
fixes #192 - reference errors and adds tests