fixed some bugs, and use global parameter to catch value
fixed void type