Changed ValueError except block

Inserted check to detect an error raised by myself.
See github issue #