Fix NPE in Patterns