Didn't know global scope in a script gets reevaluated when switching pages and coming back, so const got redeclared...