added beetter error handling
this is noto so good