a big mistake fixed

must judge if err is nil