corrected logic eeror