Fix Undefined Index and array_merge warning in Lib

Found while running update.php

Change-Id: I5c1b88f1fe2c0227f4751a4b25794c61b07a99e8