Fix the file converter

Some bugs are known, which will be fixed later