handle case doc is empty