Added is_object() check to fix potential error in HHVM