Build fixes (mostly dead code)