fixed bug in builder withPatternDefinitions() + added more tests