logic was wrong