avoid using makedirs

check for directory existence explicitly
because makedirs craps out if the dir exists but has different
permissions