improved duplicate migration detection