Backport changes made in demo.