fix crash in FreeEncodings()