matrix pattern class constructors fix