fix tests and nfree computation