some improvements to set, still segfaults