Fix error that would make invalid solutions