Bug fixes. Merged with Merged with https://github.com/herrniemand/DFGD.