fix perms. fixes #631 #639 #640 #641