permissions bugs fixed