KAS: small coding tweaks to clean up locking