add error handling for teacher