Fixed more bugs in pattern.