Minor bug fixes in authentication