This really doesnt fix the bug. The padding size calculation is wrong. That is why encoded names are getting wrong. Thanks for figuring out the code path. I have fixed the padding calculation. Please build the latest megacmd and try it out.