For example, capital seems to be predetermined based on its law of motion. But that is not the case in your production function
y = exp(-gamma*Z) * (k_fossil + k_rest)^a1 * l^a2 * E^(1 - a1 - a2); // Return on capital //r = a1 * y / (k_fossil + k_rest);
Also, Timing of capital in two sector model may be relevant.