fix problem with matrix type
introduce commandline arguments and also report average