handling all sorts of errors