Add global $cfg to avoid php notice