Issue #97: catching all exceptions while running algorithm OR rendering

Also fixed an off-by-one bug with exception stack trace extraction