Fixing rare alert (undefined Variable)