improve the error logging on check_file and check_dir by replacing it
with _check_type