fixed small bug.  Did some tests, it look good so far.