fixing some bugs; redo unique check on update