modified for python 3.2 support, fixed a bug with successive backfills