Fix typo and make q matrix