Fix test failure and findbugs warnings