improved rwlock. still hangs from time to time