created a safe_mkdir