Added error checking for BuildAttributeCache