bug in hdi function