Fixes null pointer issue encountered by John B.