fix and reimplement pbuffer support