Correctly replace files and correct unit test