added some stuff to debug permission issue