Fix script execute twice issue