setTimeout in wrong spot