adding file mode support