fix some unexpected errors