fix bug with stale length