bug fixes, dead code elimination after returns