[fix] check type before comparison