add @ operator to mkdir call to prevent the case the directory gets created after the is_dir check
closes #615