Fix matrix boolean to matrix integer