Add more checks to loadConfig