matrix calc is almost ok