add dump() function to store results in files
fix path-handling in dump()