Fix unittest failing sometimes