more matrix format conversions, fix wrong operation nesting