updated cast and instanceof
disabled error messages