initial fixes for lua script hang