added safe_quit() to lua