Use fancy construct to check two types in one go

Thanks Toshio for the tip!