Dynamic casts and null checking ftw