Fix for copy buffer bug in last commit.