clone.c: move more code into the "if (refs)" conditional