fixed event bug in js