various js bug fixes in chat window and persistent messages