restore upstream code