small changes to javascript