Protects `$reference` detection from null error