Catch exception from invalid scripts during save&load (Fixes #1590)