improvement in mergetables.sh