Merge pull request #396 from mmklee/bug_fac

fix: possible seg fault in factorization
chg: added test for possible seg fault in factorization