Added isObject check