Ensure we dont try to save empty aggregate values
Correct subquery logic for getting latest builds