fix circular deps and format stacktrace