corrected bug about setinterval call