mkdir: improve error handling (closes #121)