Updated creation of migration maintenanceevent

Also edited $agent