fixed lots of compile bugs in wtext.c and made a few api changes to it