Fixed broken handling of CURRENT reference in count_unfinished_migration.