Added missing ensureToast function when no toast method is available