Merge pull request #1576 from Dumk0/patch-6

improvement for latest migration id calculation