performance twiddling.
various little fixes every whichway