Bug fixes in DIR calculations