matrix code fixes