added more error handling to attendance