Bugfixes in the activity optimization migration