correct typo and improve logging