fix problem where only first email had text body
Bug fixes for attendance queries