js bug fixes