fix a bug that accessing invalid range of list