safer object/array check