Several fixes for merge file handling: