Fixed "Bad heap release" bug (issue #1)