A couple of fixes in js