rm deadcode and fix tests