Fix EJSON.equals and EJSON.clone to use better loops; be more correct