matrix stack improvements