Fixed the robot detection algorithm