Fixes for 3.18

My changes to get 3.18 to compile.