fix resize bug and support custom attributes.