Made some tests more robust