fix spanning problem