Fix randomly failing test