Fixed various race conditions with loading