Tests: fix some bugs.