Fixed issue where when output file was a directory the subsequent output file was appended to the original, instead of replaced. Also fixed typo where path.join() was written as path.combine().