adapted to newer version