diff --git a/src/MediaDataRepresentation.vala b/src/MediaDataRepresentation.vala
index 1afd851..9766871 100644
--- a/src/MediaDataRepresentation.vala
+++ b/src/MediaDataRepresentation.vala
@@ -172,6 +172,11 @@ public abstract class MediaSource : ThumbnailSource, Indexable {
             PrepareInputTextOptions.DEFAULT & ~PrepareInputTextOptions.STRIP_CRLF & ~PrepareInputTextOptions.EMPTY_IS_NULL, -1);
     }
     
+    public static string? prep_filename(string? filename) {
+    	return prepare_input_text(filename,
+    		PrepareInputTextOptions.DEFAULT & ~PrepareInputTextOptions.STRIP, DEFAULT_USER_TEXT_INPUT_LENGTH);
+    }
+
     public abstract Rating get_rating();
     public abstract void set_rating(Rating rating);
     public abstract void increase_rating();
@@ -717,8 +722,12 @@ public abstract class MediaSourceCollection : DatabaseSourceCollection {
         
         foreach (MediaSource source in sources) {
             File file = source.get_file();
+            File masterfile = source.get_master_file();
             try {
                 file.delete(null);
+                if (masterfile != null && masterfile.query_exists()) {
+                	masterfile.delete(null);
+                }
             } catch (Error err) {
                 // Note: we may get an exception even though the delete succeeded.
                 debug("Exception deleting file %s: %s", file.get_path(), err.message);
@@ -781,7 +790,6 @@ public class MediaCollectionRegistry {
         LibraryMonitor replacement = new LibraryMonitor(import_dir, true,
             !CommandlineOptions.no_runtime_monitoring);
         LibraryMonitorPool.get_instance().replace(replacement, LIBRARY_MONITOR_START_DELAY_MSEC);
-        LibraryFiles.select_copy_function();
     }
     
     public static MediaCollectionRegistry get_instance() {
