Error relating to the uninitialized variable $cfg corrected