making locking views work generically