Added type validation at set fields method