fix outer name and use clone_opt if optional type