changed back to before_save hook in and testing for file existence