Bugfix: bad error logic