Added check for empty data