Fixing unchecked cast warnings.