logic fixes and creation of results dir