Prevent duplicate logins
Fix build and a few includes
Fix jsoncpp library dependency