Move some logging to correct place