added count check in migrate