check if the object exists before trying to return a datastream