Closes #1695 - Don't write the previous bucket for buckets that should be empty
Merge branch 'master' into pr