modification on lua patch