fixed bug in build index