Added path validation to file handler.