hopefully fix index off by one errors