Backport PR #5613: Fixing bug #5607

Changed the method from extends to merge which merges the two arrays as
desired - With Freyert

Testing: Manually verified the fix.