state.cpp - backport aliaspider patches