fix resource creation order.