logic errors fixed.