add permissions to manifest and fix a few little bugs