fixed and completed lzwencoder