Improve logging
Fix some mistakes