Fixed sometimes failing tests