Fixed a possible bug when swiping outside of the matrix.