Fix double buffering in smart str encoding wrapper