Fixed old warnings and some build errors