Fixed reference counting problem