fix matrix expressions bug