Fix null ref error in model cache - don't cache null values