added exception handling in order to catch illegal size in Matrices