Fix create heap function