fix template script mode