Added exception safety to lua entrypoints