improved the generated function for sparse reverse one mode; minors fixes