Fix bugs for function ListInsert.