fix order of afterinit events