Added errors and better checking to patterns_file_is_modified