Fix update_attributes and add some utility methods