inital error handing added