added check if path exists