Fix documents contrller bug and freeze paperclip gem