Fix minor JS variable declaration bug