general set() function