Fixed ugly index bug in CheckAttributeLayout