fixed error message handing;