Fixed permissions error and made permissions a settable variable.

Permissions were being set by a string, not an integer.