-- fixed error handling