move a few variables around; also add the DATEFILEDIR patch from Rick