Added check for empty content to prevent throwing