finally fixed javascript problems