fix wrong permissions and other cleanup