Fixing concurrent modification exceptions
Fixing concurrent null pointer exception and making posterior and prior count access atomic