more logic fixes