Fixed many bugs in base classes.