am be634951: Fix permission problem and NPE

* commit 'be63495101dba3b0c3c496cdd810df9e30e926d4':
  Fix permission problem and NPE