fix some loading order issues