fix several issues with javascript and websocke