fixing matrix counts