bugfix and permissions fix