FIX: segfault w/concurrent update operations

bucket_env was being acquired outside of the critical section;
under heavy load the garbage collector may erase the env before
the function acquires the rwlock, leaving the function with a
bad pointer.