Fixed math popover not closing and preview not working