Fix misc warnings in advanced_inv.cpp

Just some warning fixes. Also line 477 is a true bug fix.