Some more fixes and logging