added index checking on model load