Fix logged out state detection with API

Add error description for unexpected JSON format