Code generation changes for maps (from rleigh)