better buffer-copying