Fixed a bug caused by files sometimes being loaded out of order.