Improve check mode support in the file module.