More fixes for more invalid casts