Fix makefile trouble if tmp doesn't exist. Fix bugs in Matrix