Matrix Generation Fix

Fixes issue #6.