basic logic fixes