add mkdir exception handling
fix the exception type error