Fix buffer allocation in sink
Make sink compile against both API versions