added support for nullable fields
fixed minor issues