Misc fixes for WX

See commit description for details.