- adapted to changes in matrix lib