Added better handling of direct I/O and remote files.