corrected reference counting after level-0 written, thus fixed gianormous memory leak.