fixed bug in loggedInAsTeacher middleware