Updated from commit 501df59c1eb09b9c44491ba1f9af6813b98bcbed.