fix horrendously slow contact message query