fixed javascript problems