Added optional variable check before sending notification