fix logic to make sense