modify to wrap buffer lines