changed error mgmt and type harmonizing