Fixing inconsistencies and bugs