Fix bug to change robot state correctly.