fix wx failed assertion (Destroy() with invalid item called)

(how the hell did this code work at all?)
fix assertion in config (can't write value to section)