change file handling for JRE6 compatibility