included changes in https://github.com/thoughtbot/paperclip/pull/1241/files