fixed a few bugs in class gen