Bugfix: copy buffer only if requested