Hopefully corrected segfault because matrix was not initialized