fixes simulation bug