better handling file sanitizing