edit and fix direct product decomposition