fixed error in geninv.cpp