Scripting: Better error handling