matrix detect bug fixed