fix null ptr bug for data migration