Except handler bug

Fixes #555.