Fix double loading.

See commit message for full details. This should fix the stack overflow issues we were getting in production.