permissions tests started and some bugs fixed