added error mgmt