Fixed file permission flags
Added pull request 14 from @untoldone
Fixed issue 11 from @TizianoPerrucci