fix leaks, improve OX objects' life cycle