fixed some unchecked casts