Fix sporadic failures caused by timing