Fix small matrix bug