change to return only on error