convert heap functions