fixed exception handling inside generators