change working dir before loading Lua script. add SIGTERM and SIGQUIT signals