Backport #16886 to 2014.7

Replaces #16898.

CC @thatch45 and @rallytime.