IO edge cases

Fixes #642 
Fixes #647 
Fixes #646 
The generator might not be a generator and may throw an exception while not being a generator