diff --git a/annotation/src/main/java/lcsb/mapviewer/annotation/cache/PermanentDatabaseLevelCache.java b/annotation/src/main/java/lcsb/mapviewer/annotation/cache/PermanentDatabaseLevelCache.java
index 607a26f3ba2166176d90aa00fa55c754a1d6c97f..ed4c5e5240cf5305eb7890d48e38ced44f6d7965 100644
--- a/annotation/src/main/java/lcsb/mapviewer/annotation/cache/PermanentDatabaseLevelCache.java
+++ b/annotation/src/main/java/lcsb/mapviewer/annotation/cache/PermanentDatabaseLevelCache.java
@@ -80,14 +80,16 @@ public class PermanentDatabaseLevelCache extends XmlParser implements PermanentD
 
 		@Override
 		public CacheQuery call() throws Exception {
-			logger.debug("Query task call");
-			dbUtils.createSessionForCurrentThread();
-			logger.debug("Query task session started");
-			CacheQuery entry = getCacheQueryDao().getByQuery((String) query, type);
-			logger.debug("Query task data retrieved");
-			dbUtils.closeSessionForCurrentThread();
-			logger.debug("Query task return");
-			return entry;
+          logger.debug("Query task call");
+          try {
+            dbUtils.createSessionForCurrentThread();
+            logger.debug("Query task session started");
+            CacheQuery entry = getCacheQueryDao().getByQuery((String) query, type);
+            logger.debug("Query task data retrieved");
+            return entry;
+          } finally {
+            dbUtils.closeSessionForCurrentThread();
+          }
 		}
 
 	}
@@ -227,26 +229,29 @@ public class PermanentDatabaseLevelCache extends XmlParser implements PermanentD
 
 		@Override
 		public CacheQuery call() throws Exception {
-			logger.debug("Add task call");
-			dbUtils.createSessionForCurrentThread();
-			CacheQuery entry = getCacheQueryDao().getByQuery((String) query, type);
-
-			if (entry == null) {
-				entry = new CacheQuery();
-				entry.setQuery((String) query);
-				entry.setAccessed(Calendar.getInstance());
-			} else {
-				entry.setAccessed(Calendar.getInstance());
-			}
-			entry.setValue(value);
-			entry.setType(type);
-			Calendar expires = Calendar.getInstance();
-			expires.add(Calendar.DAY_OF_MONTH, type.getValidity());
-			entry.setExpires(expires);
-
-			getCacheQueryDao().add(entry);
-			dbUtils.closeSessionForCurrentThread();
-			return entry;
+            logger.debug("Add task call");
+            try {
+              dbUtils.createSessionForCurrentThread();
+              CacheQuery entry = getCacheQueryDao().getByQuery((String) query, type);
+      
+              if (entry == null) {
+                entry = new CacheQuery();
+                entry.setQuery((String) query);
+                entry.setAccessed(Calendar.getInstance());
+              } else {
+                entry.setAccessed(Calendar.getInstance());
+              }
+              entry.setValue(value);
+              entry.setType(type);
+              Calendar expires = Calendar.getInstance();
+              expires.add(Calendar.DAY_OF_MONTH, type.getValidity());
+              entry.setExpires(expires);
+      
+              getCacheQueryDao().add(entry);
+              return entry;
+            } finally {
+              dbUtils.closeSessionForCurrentThread();
+            }
 		}
 
 	}
@@ -290,13 +295,16 @@ public class PermanentDatabaseLevelCache extends XmlParser implements PermanentD
 		@Override
 		public CacheQuery call() throws Exception {
 			logger.debug("Remove task call");
-			dbUtils.createSessionForCurrentThread();
-			CacheQuery entry = getCacheQueryDao().getByQuery((String) query, type);
-			if (entry != null) {
-				getCacheQueryDao().delete(entry);
-			}
-			dbUtils.closeSessionForCurrentThread();
-			return entry;
+            try {
+              dbUtils.createSessionForCurrentThread();
+              CacheQuery entry = getCacheQueryDao().getByQuery((String) query, type);
+              if (entry != null) {
+                getCacheQueryDao().delete(entry);
+              }
+              return entry;
+            } finally {
+              dbUtils.closeSessionForCurrentThread();
+            }
 		}
 
 	}
diff --git a/annotation/src/main/java/lcsb/mapviewer/annotation/services/ChemicalParser.java b/annotation/src/main/java/lcsb/mapviewer/annotation/services/ChemicalParser.java
index df03d1175cb14e1d072df7f3eb0649473bf1d2b6..014346e3767002a35cf441bd4f1532fa093961cd 100644
--- a/annotation/src/main/java/lcsb/mapviewer/annotation/services/ChemicalParser.java
+++ b/annotation/src/main/java/lcsb/mapviewer/annotation/services/ChemicalParser.java
@@ -57,18 +57,18 @@ public class ChemicalParser extends CachableInterface implements IExternalServic
 	/**
 	 * Homepage of drugbank.
 	 */
-	static final String							URL															= "http://ctdbase.org/";
+	static final String							URL															= "https://ctdbase.org/";
 
 	/**
 	 * URL to get a list of chemicals by disease id.
 	 */
-	public static final String			DISEASE_URL											= "http://ctdbase.org/detail.go?6578706f7274=1&d-1332398-e=5&view=chem&"
+	public static final String			DISEASE_URL											= "https://ctdbase.org/detail.go?6578706f7274=1&d-1332398-e=5&view=chem&"
 			+ "type=disease&acc=MESH%3A";
 
 	/**
 	 * URL to get a list of chemicals by gene id.
 	 */
-	public static final String			DISEASE_GENE_URL								= "http://ctdbase.org/detail.go?slimTerm=all&6578706f7274=1&qid=3464576&"
+	public static final String			DISEASE_GENE_URL								= "https://ctdbase.org/detail.go?slimTerm=all&6578706f7274=1&qid=3464576&"
 			+ "d-1332398-e=5&view=disease&type=gene&assnType=curated&acc=";
 
 	/**
@@ -218,7 +218,7 @@ public class ChemicalParser extends CachableInterface implements IExternalServic
 				}
 			}
 
-		} catch (FileNotFoundException e) {
+		} catch (WrongResponseCodeIOException e) {
 			// it means that there are no results for this query
 		} catch (IOException e) {
 			throw new ChemicalSearchException("ctdbase service unavailable", e);
@@ -447,14 +447,14 @@ public class ChemicalParser extends CachableInterface implements IExternalServic
 				if (entrez == null) {
 					invalidHgnc.add(md);
 				} else {
-					String query = "http://ctdbase.org/detail.go?type=gene&view=ixn&chemAcc=" + chemID.getResource() + "&acc=" + entrez.getResource();
+					String query = "https://ctdbase.org/detail.go?type=gene&view=ixn&chemAcc=" + chemID.getResource() + "&acc=" + entrez.getResource();
 					String referencesPage = getWebPageContent(query);
 					Matcher matcher = pattern.matcher(referencesPage);
 					while (matcher.find()) {
 						idx.add(matcher.group(1));
 					}
 					for (String string : idx) {
-						String query2 = "http://ctdbase.org/detail.go?6578706f7274=1&d-1340579-e=5&type=relationship&ixnId=" + string;
+						String query2 = "https://ctdbase.org/detail.go?6578706f7274=1&d-1340579-e=5&type=relationship&ixnId=" + string;
 						String referencesPage2 = getWebPageContent(query2);
 						String[] lines = referencesPage2.split("\n");
 						for (int i = 1; i < lines.length; i++) {
diff --git a/annotation/src/main/java/lcsb/mapviewer/annotation/services/PubmedParser.java b/annotation/src/main/java/lcsb/mapviewer/annotation/services/PubmedParser.java
index f917270d8a88f9da0a9c4f27bf0235caa230838f..0fbcd7a00e507a8d95cb43a2491c02a565fc1610 100644
--- a/annotation/src/main/java/lcsb/mapviewer/annotation/services/PubmedParser.java
+++ b/annotation/src/main/java/lcsb/mapviewer/annotation/services/PubmedParser.java
@@ -29,7 +29,7 @@ import lcsb.mapviewer.model.map.MiriamType;
 
 /**
  * This class is a backend to publically available pubmed API in
- * <a href="http://europepmc.org/RestfulWebService">Europe PubMed Central </a>.
+ * <a href="https://europepmc.org/RestfulWebService">Europe PubMed Central </a>.
  * 
  * @author Piotr Gawron
  * 
@@ -57,6 +57,8 @@ public class PubmedParser extends CachableInterface implements IExternalService
 	 */
 	static final String						 SUPPORTED_VERSION				= "5.2.2";
 
+    static final String API_URL = "https://www.ebi.ac.uk/europepmc/webservices/rest/";
+
 	/**
 	 * Connector used for accessing data from miriam registry.
 	 */
@@ -131,7 +133,7 @@ public class PubmedParser extends CachableInterface implements IExternalService
 
 		result = new Article();
 		try {
-			String url = "http://www.ebi.ac.uk/europepmc/webservices/rest/search/resulttype=core&query="
+			String url = API_URL+"search/resulttype=core&query="
 					+ java.net.URLEncoder.encode("src:med ext_id:" + id, "UTF-8");
 
 			String content = getWebPageContent(url);
@@ -261,7 +263,7 @@ public class PubmedParser extends CachableInterface implements IExternalService
 
 	@Override
 	public ExternalServiceStatus getServiceStatus() {
-		ExternalServiceStatus status = new ExternalServiceStatus("Europe PubMed Central", "http://europepmc.org/RestfulWebService");
+		ExternalServiceStatus status = new ExternalServiceStatus("Europe PubMed Central", "https://europepmc.org/RestfulWebService");
 		GeneralCacheInterface cacheCopy = getCache();
 		this.setCache(null);
 
@@ -292,7 +294,7 @@ public class PubmedParser extends CachableInterface implements IExternalService
 	 */
 	public String getApiVersion() throws PubmedSearchException {
 		try {
-			String url = "http://www.ebi.ac.uk/europepmc/webservices/rest/search/resulttype=core&query=src%3Amed+ext_id%3A23644949";
+			String url = API_URL+"search/resulttype=core&query=src%3Amed+ext_id%3A23644949";
 
 			String content = getWebPageContent(url);
 
diff --git a/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/EnsemblAnnotator.java b/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/EnsemblAnnotator.java
index f3dfdc8aead7a80f6cafce1724e6470a638175f0..07692f2bf2b14a16a8667aafc10c6b81f7897694 100644
--- a/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/EnsemblAnnotator.java
+++ b/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/EnsemblAnnotator.java
@@ -29,7 +29,7 @@ import lcsb.mapviewer.modelutils.map.ElementUtils;
 
 /**
  * This class is responsible for connecting to
- * <a href="http://rest.ensembl.org">Ensembl API</a> and annotate elements with
+ * <a href="https://rest.ensembl.org">Ensembl API</a> and annotate elements with
  * information taken from this service.
  * 
  * 
@@ -46,7 +46,7 @@ public class EnsemblAnnotator extends ElementAnnotator implements IExternalServi
 	/**
 	 * Url address of ensembl restful service.
 	 */
-	private static final String	REST_SERVICE_URL				 = "http://rest.ensembl.org/xrefs/id/";
+	private static final String	REST_SERVICE_URL				 = "https://rest.ensembl.org/xrefs/id/";
 
 	/**
 	 * Suffix that is needed for getting proper result using
@@ -57,7 +57,7 @@ public class EnsemblAnnotator extends ElementAnnotator implements IExternalServi
 	/**
 	 * Url used for retrieving version of the restful API.
 	 */
-	private static final String	REST_SERVICE_VERSION_URL = "http://rest.ensembl.org/info/rest?content-type=text/xml";
+	private static final String	REST_SERVICE_VERSION_URL = "https://rest.ensembl.org/info/rest?content-type=text/xml";
 
 	/**
 	 * Default constructor.
diff --git a/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/HgncAnnotator.java b/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/HgncAnnotator.java
index c4e5cb7b25e514eaadeaea0a43e33c695fe6c45b..a542728437b4eba270c3abad9439ccca70c5a25e 100644
--- a/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/HgncAnnotator.java
+++ b/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/HgncAnnotator.java
@@ -14,6 +14,7 @@ import lcsb.mapviewer.annotation.cache.WebPageDownloader;
 import lcsb.mapviewer.annotation.services.ExternalServiceStatus;
 import lcsb.mapviewer.annotation.services.ExternalServiceStatusType;
 import lcsb.mapviewer.annotation.services.IExternalService;
+import lcsb.mapviewer.annotation.services.WrongResponseCodeIOException;
 import lcsb.mapviewer.common.exception.InvalidArgumentException;
 import lcsb.mapviewer.common.exception.InvalidXmlSchemaException;
 import lcsb.mapviewer.model.map.BioEntity;
@@ -29,7 +30,7 @@ import lcsb.mapviewer.modelutils.map.ElementUtils;
 
 /**
  * This class is responsible for connecting to
- * <a href="http://rest.genenames.org/">HGNC restfull API</a> and annotate
+ * <a href="https://rest.genenames.org/">HGNC restfull API</a> and annotate
  * elements with information taken from this service.
  * 
  * 
@@ -40,7 +41,7 @@ public class HgncAnnotator extends ElementAnnotator implements IExternalService
 	/**
 	 * Address of HGNC API that should be used for retrieving data.
 	 */
-	private static final String REST_API_URL = "http://rest.genenames.org/fetch/";
+	private static final String REST_API_URL = "https://rest.genenames.org/fetch/";
 
 	/**
 	 * Default constructor.
@@ -231,6 +232,8 @@ public class HgncAnnotator extends ElementAnnotator implements IExternalService
 						}
 					}
 				}
+            } catch (WrongResponseCodeIOException e) {
+              logger.warn(prefix + "Cannot find information for element.");
 			} catch (Exception e) {
 				throw new AnnotatorException(e);
 			}
@@ -314,7 +317,10 @@ public class HgncAnnotator extends ElementAnnotator implements IExternalService
 				}
 			}
 			return result;
-		} catch (Exception e) {
+        } catch (WrongResponseCodeIOException e) {
+          logger.warn("No HGNC data found for id: "+miriamData);
+          return new ArrayList<>();
+        } catch (Exception e) {
 			throw new AnnotatorException(e);
 		}
 
diff --git a/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/ReconAnnotator.java b/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/ReconAnnotator.java
index 3e26f3006a7d190ec35450ba5f9c388cc2d4e8af..c006d49ed4106d58c1323c1bf5dcd930001bcf36 100644
--- a/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/ReconAnnotator.java
+++ b/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/ReconAnnotator.java
@@ -43,7 +43,7 @@ public class ReconAnnotator extends ElementAnnotator implements IExternalService
 	/**
 	 * Address of annotation rest service for reactions.
 	 */
-	private static final String	REACTION_ANNOTATION_URL_PREFIX = "http://vmh.uni.lu/_api/reactions/?page_size=10000&format=json&search=";
+	private static final String	REACTION_ANNOTATION_URL_PREFIX = "https://vmh.uni.lu/_api/reactions/?page_size=10000&format=json&search=";
 
 	/**
 	 * Class used for some simple operations on {@link BioEntity} elements.
diff --git a/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/UniprotAnnotator.java b/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/UniprotAnnotator.java
index 997494bd6562f088eb1fd2a0ce46aa3f15912f6b..332354bed41576191fcd66fc72d10f5f8e4eacf1 100644
--- a/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/UniprotAnnotator.java
+++ b/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/UniprotAnnotator.java
@@ -134,7 +134,7 @@ public class UniprotAnnotator extends ElementAnnotator implements IExternalServi
 	 * @return url to uniprot restfull API about uniprot entry
 	 */
 	private String getUniprotUrl(String uniprotId) {
-		return "http://www.uniprot.org/uniprot/" + uniprotId + ".txt";
+		return "https://www.uniprot.org/uniprot/" + uniprotId + ".txt";
 	}
 
 	/**
diff --git a/annotation/src/test/java/lcsb/mapviewer/annotation/services/ChemicalParserTest.java b/annotation/src/test/java/lcsb/mapviewer/annotation/services/ChemicalParserTest.java
index f03eb92e179fd32c00e3ac5686e069374d0d8a32..38fa0393ed9e2677e5b5c76870cff9bfc3b8bba8 100644
--- a/annotation/src/test/java/lcsb/mapviewer/annotation/services/ChemicalParserTest.java
+++ b/annotation/src/test/java/lcsb/mapviewer/annotation/services/ChemicalParserTest.java
@@ -551,7 +551,7 @@ public class ChemicalParserTest extends AnnotationTestFunctions {
 			// remove info about single publication from cache (so we will have to
 			// download it)
 			chemicalParser.getCache().removeByQuery(
-					"http://ctdbase.org/detail.go?6578706f7274=1&d-1340579-e=5&type=relationship&ixnId=4802115", chemicalParser.getCacheType());
+					"https://ctdbase.org/detail.go?6578706f7274=1&d-1340579-e=5&type=relationship&ixnId=4802115", chemicalParser.getCacheType());
 
 			// disallow to use cache for first query (it will be directly about drug),
 			// so parser will have to parse results taking data from cache (or