shrink buffer in a better way.