Added a workaround for a call to loginhandler when login window is already set (inspired by 172f10b)