fix bug with permissions