fixed compat with mercurial api. thanks to devurandom