Fix wx2.9 compatibility and cleanup

Tested on both wx2.9 and wx2.8, shouldn't bring any regression.