Fixed bug in extra_patterns generator