Fix incorrectly short buffer size for creating flat pattern.