Fixed possible nil reference with GCed objects.