Add nil check for migration