fix a bug when inverted list is empty
add comments