fix bug in lua script