fix mat initialization