fixed a possible crash in wx