improved test handling