fix tests & bugs