logic bug fixed.