fix logic statement