fix issue with index service that causes empty types to return undefined, more cleanup, fix tests