Refactored for better error handling
Fix Dirconf