fix tests

follow api changes introduced in ed88ef0a
use new api in test
fix inverted condition in code