better authentication (fixes #345).