Fixes to codegen and more
Also set pointer type var to nil in fix empty types