fixed bugs and simulator