check length before compare contents