Fixing segfault with linear regression