replacing buffer var name with buf