Closes #539 Correct mknod implementation

Tested on Ubuntu, CentOS and OSX.