Fix some compile errors. Tweak some type mappings and macro expantions.