Corrected bug in duplicating files