add missing end() call that was making test fail in various ways