- fixed incorrectly raise error when err is null