Backport 4114 fix to 2013.10.23 train.

Note: this is just backporting the fix that was landed in dev already. See #4114 for more.