define ids and fix a js bug