Some days ago someone mentioned Globe in another thread.
That tool is really extremly cool to check for problems.
https://www.townlong-yak.com/globe/
There are some potential problems in your code.
A global use of unitplate for example.
While options is local you create a global frame by naming it options. Such a common name is really dangerous I think.
Lua Code:
local options = CreateFrame("Frame", "options", InterfaceOptionsFramePanelContainer)
Another code that might be a problem ... the first button1 is local but not at the time you use it as name.
Lua Code:
local button1 = CreateFrame("button", button1, options, "UIPanelButtonTemplate")