adapted to newest libs