Bug fixes on spreading algorithm