added check for robot going backwards