FoxxModel.set validation

Fixes #926. Also implemented basic type checking.