fixing the mmd estimation