Minor bugs and dead code