Fixed inconsistencies and bugs