fix template compile and refresh