add exceptions for write file