Improve latest activity query for 4.4