added check to index