Type checking and upgrades for record writing.
some more cases
maja's comments
Merge pull request #40 from facebook/type-upgrades

Type checking and upgrades for record writing.