be smart about filetype validation