add attribute type and value validation
fix error code on validation error