Some minor fixes and logging