When retrieving username in checkwrite use getUsernameFromSiteDB from client_utilities, like in standalone checkusername.