Fixing variable merging