Some fixes to attendance api queries