fixed foreignkey and added permissions