Fixed potential crash in word expansion API

10.5.8 PPC crashed 100%, some versions of 10.6 i386 were affected too