Making sure we prune invalid solutions