fixed off-by-one errors in contract sampleing rate code