Fix mergeValue method