fix javascript behavior bugged