Fix bug where prefix (basename, aka outputpre) goes before the path rather than before the filename.