diff --git a/src/collection/hashset.scad b/src/collection/hashset.scad
index f4561169..1696b3db 100644
--- a/src/collection/hashset.scad
+++ b/src/collection/hashset.scad
@@ -4,11 +4,11 @@ use <_impl/_hashset_add_impl.scad>;
 	
 function hashset(lt, eq = function(e1, e2) e1 == e2, hash = function(e) _str_hash(e), bucket_numbers) =
     let(
-		leng_lt = len(lt),
 	    lt_undef = is_undef(lt),
+		leng_lt = lt_undef ? -1 : len(lt),
 		bucket_numbers_undef = is_undef(bucket_numbers),
 		b_numbers = bucket_numbers_undef ? 
-		               (lt_undef ? 16 : ceil(sqrt(leng_lt))) : bucket_numbers,
+		               (lt_undef || leng_lt < 256 ? 16 : ceil(sqrt(leng_lt))) : bucket_numbers,
 	    buckets = [for(i = [0:b_numbers - 1]) []]
 	)
 	lt_undef ? buckets : _hashset(lt, leng_lt, buckets, eq, hash);
\ No newline at end of file
diff --git a/test/collection/test_hashset.scad b/test/collection/test_hashset.scad
index 2f3ffe03..7c606ef3 100644
--- a/test/collection/test_hashset.scad
+++ b/test/collection/test_hashset.scad
@@ -9,15 +9,14 @@ module test_hashset() {
     echo("==== test_hashset ====");
 
     s = hashset([1, 2, 3, 4, 5, 2, 3, 5]);
-
-    assert(hashset_list(s) == [3, 1, 4, 2, 5]);
+    assert(hashset_list(s) == [1, 2, 3, 4, 5]);
 
     s2 = hashset_add(s, 9);
-    assert(hashset_list(s2) == [3, 9, 1, 4, 2, 5]);
+    assert(hashset_list(s2) == [1, 2, 3, 4, 5, 9]);
 
     assert(!hashset_has(s2, 13));
     
-    assert(hashset_list(hashset_del(s2, 2)) == [3, 9, 1, 4, 5]);
+    assert(hashset_list(hashset_del(s2, 2)) == [1, 3, 4, 5, 9]);
 }
 
 test_hashset();
\ No newline at end of file