fixes to enable automatic reference counting