Fix scoping with safe views