fixed some lua problems (finally)