Fix simu

Some fixes for simulator, please review them. Thanks!