more fixes. added secure mode