bug fix should not use settimeout, use setTimeout