added enforce replica, fixed some bugs..