Permission fix. Ticket #137

First merge for permissions fix.