fixed some simulation logic errors