corrected OK button logic