fixing comm indexer test and adding valid state check function