Bug fixes for 'buffer' functions