fixed setTimeout setup in js