fix #2145 and related oilgen issues