fixed implementation for c. need to update to the recent changes in interfaces on buffer