fix issues in the pattern implementations