Fixed bug with matrix positioning