fix release methods to match foreignPtr usage