[fix] check both object existence and length property