Fix js issue with non-numeric ids

Closes #658 
Closes #570 (found this later)