Fix bugs in credentials dialog