fixed issue with Error not working in Java/C#