added instanceof contstraint to patterns