Fixing NOTICE error about undefined variable