better type checking for obj / arrays