Optimizations (some were really bug fixes, but they only affected
performance) for pot reload.