Fixing a null ref