Bug fix on before migration