Fixing countObjects and security (MID-1874)