fix small bugs, added option for indexing