Fixing null refs