fix index building and add simple key look