How to work around the bug which prevents custom menus from being deleted?

How to work around the bug which prevents custom menus from being deleted?