Fix bugs in Fence Resource.