simplify and fix intermittent teest errors