add min/max to block definitions

Also prevents numeric fields from having non-numeric or otherwise invalid values. Fixes #791 and #334.