Changed some username queries into userid queries