The casts here appear to be unneeded and may mask possible errors.

Also, why not use braces?