doing the same for object and array types