fix permissions bug and improve appmanager