fixed heap problems