remove duplicate javascript code causing issues