Added tests
Fixed chmod