Merged commit 1ace950 from upstream repo (Attempt to fix concurrent problem causing NPE)