fix sql sorting of builds; fix build error