fix detect matrix bug when going back to menu from game