Check object type before using them.