Backport #590 in 2.3