fix bug where err = should have been err :=