fix issue #20

I have not checked the CGO part. Hope it works for lua5.1 and lua simultaneously.