Fix exception message
Simplify reference counting