fixed code for compareMaxSpeed