code change to handle null case in matchesGivenSolution