Changed migrate code