Made the config file reading more robust