fixed bugs and added conflict resolution