Fixed linear regression and added unit tests