Fixed some errors in simulator