Two minor optimizations in heavily used code paths.