merge-function bugfix