Fix random crashes, add optional delay