make test more robust and remove unused references