major cleanup of get-optiontables, fix