update scripting, add exception handling