Fixed bug on using indexes on subclasses. Issue #8