fixes to the previous refactoring of patterns