more fixes and logging