fixed a bug with subclasses