improve persist_to_bins