Fixed a bug occuring when using ssl