two improvements to bucket plugin

Hi,

this time with tests and doc.