add contrib/generic;bug fixes