Implement setenv correctly and support setting values to empty strings