Fixed bug in primitive formulation