added code for migration handling