fix bug in _test function