Fix automatic pattern detector