Add condition for nil attribute.type