use correct logic so it works