fix step counter logic