Tests, fixes for heap