Bugfixes; increased debug output in matrices.py