Fix confusing bug where codes were being incorrectly cast to string