Fixed incorrect pattern count causing a crash when cycling through patterns.