Fixing MD encoding