It compared against the wrong variable. Fixed this by getting rid of lc_name entirely and use equals_literal_ci instead.