Matrix error fix