Merge "Improve readability and add protections against use after release NPE" into main