Core data problem swift

Hi All

I have a strange problem that i can nail down

When i run the function below for the first time to collect data from core data it works fine
but when i call it a second time it return an empty array

the point being it works fine one but only once, i can assure you i call with the same params etc

I don’t know if the code below will be enough info but we will see

thanks in advance
func getQuestions(set : Int16)->[Questions]{

    var questions = [Questions]()
    let fetchRequest : NSFetchRequest<Questions> = Questions.fetchRequest()
    // select the questions with the matching parametewrs
    let predicate = NSPredicate(format : "set = %@" , String(set))
    fetchRequest.predicate = predicate

    do {
        
        questions = try context.fetch(fetchRequest)
        print(questions.count)
        if questions.count > 0 {
            
            // MARK: Bug Fix
            // fix bug to prevent current answer retaining a change when
            // a new project is created...
            // someware questions array in not getting reset and i can't find it
            //
            for index in 0...questions.count - 1 {
                
                questions[index].currentAnswer = 0
            }
            
            return questions
        }
    } catch {
        
        let error = error as NSError
        print("QuestionMethods: getQuestions \(error)")
    }
    
    return questions
}