Fixed a hang in stub simulation