changing file path and error handling