Fixed conversion of mode from string to integer. Mode string is now converted to octal integer.