Fix #140 (Chmod on folder throws error)
Fix #139 (Return error on invalid chmod).
Merge pull request #141 from PressLabs/fix-chmod-on-dirs

Fix chmod (restrict modes to 0755, 0644 on files and 0755 on folders).