fixed treatment of filename when namesource is not a file