Bug #12999: fix PHP warning
Bug #13008: fix global usage
Bug #13008: Fix rename
Bug #13003