add file encode/decode but buggy