Least-squares fitting of data with large errors