err handling when buffer not contiguous