Fixed: check for error case was backwards.