Improved path handling, timeout, errorhandling

Improved path handling, timeout, errorhandling