removed warnings: dead code that generated warnings; casts