Repaired operator~, getLength function