auto set returnType by index&type & refactor