bugfix in sim functions