Fix tests hanging