Fix NPE caused by map value being removed between the time containsKey and get are called