added checking for error type in a few more typecheck, commented where we don't need to check