using assert to return errors