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