fix add ring error while gen_type is specific, and fix the filemode