changed handling of contract depth