modify register logic, and change error code
add activate_env