Fix bug that caused 500 errors on subsequent loads.