preserve file ext if extension parameter is not specified.