Fix settimeout callback timing
Fix logging