The role of non-native interactions in the folding of knotted proteins