Bug 442980 - Fixed ClassCast exceptions in debug mode