ported to recent revision