fix a bug in indx_recovery function.