More MQTT fixes and cleanup