fixed sorting issue when simularion runs