Fix blockmap bug.
Minor performance optimizations.