Added support for buckets in thumbnails plugin
fixed metadata query