FoxxModel.set validation

Fixes #926. Also implemented basic type checking.
Could you revert that line?