Small changes to buffer management functions