logic fixes all over the place