fix up a bunch of off by ones in the dirty mapping code.
fix two signedness issues in mapping dirtying code