An instance-of assertion would be more appropriate here, I think.