fix several bugs in simulator and add CLI arguments supports for sim