Minor fixes by Seth

Use different IDs for different message types; Free encode buffers
after they are sent