fixes potential hangs