Fixed a couple of bugs, better PAM integration