Fix wrong mergeToFile callback chaining