fix schema and add second permission hook