fixed auto chmod of incoming and outgoing files

* added test and documentation