C# and Java bug fixes