Would be good if this patch is refined and submitted to upstream.