was getting 0777 converting into 511 due to an octal to decimal conversion http://unix.stackexchange.com/questions/103413/is-there-any-difference-between-mode-value-0777-and-777