improved $check_files support