add main invoke gate for user & fix several bugs