Improve to avoid NPE if the base layer is not in map