fix salt-and-pepper logic