convert pattern to flat