corrected queries in activity controller