fix small bugs found during testing
added tests for auto-generated functions