fix the js template error that would lead to crash when do rotate