Fixed a bunch of problems in bucket. Tests now run, but with assert errors. Those are probably due to changes in the bucket behaviour