matrix.cpp: fixed inputstream creation