fix reference counting exception