small fixes and dead code removal