Fix bug in codelist check