remove bubbles in matrix