Remove unused import and check return value of mkdir call