fixes #599

Also fixes a js error on page selector